package com.evil.application.pojo.dto.form;

import com.evil.application.pojo.dto.form.control.ControlBaseInfoDTO;
import com.evil.application.pojo.entity.ApplicationForm;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 表单控件树 返回实体
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
public class FormControlTreeRespDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 应用id
     */
    private Long applicationId;

    /**
     * 应用key
     */
    private String applicationKey;

    /**
     * 表单id
     */
    private Long applicationFormId;

    /**
     * 表单名称
     */
    private String formName;

    /**
     * 控件列表
     */
    private List<ControlBaseInfoDTO> controls;

    public FormControlTreeRespDTO() {
        this.controls = new ArrayList<>();
    }

    public FormControlTreeRespDTO(ApplicationForm applicationForm) {
        this.applicationFormId = applicationForm.getFormId();
        this.applicationId = applicationForm.getApplicationId();
        this.formName = applicationForm.getFormName();
        this.controls = new ArrayList<>();
    }
}
